var _tools = require("../../../utils/tools.js"), _tools2 = _interopRequireDefault(_tools);

function _interopRequireDefault(t) {
    return t && t.__esModule ? t : {
        default: t
    };
}

var that, app = getApp();

Page({
    data: {
        type: 0,
        share: {
            text: "",
            xcx_title: "",
            share_image: "",
            member_id: "",
            discount_id: 0
        }
    },
    onLoad: function(t) {
        that = this, t.type && this.setData({
            type: t.type
        });
    },
    onReady: function() {
        wx.setNavigationBarColor({
            frontColor: "#000000",
            backgroundColor: "#000000"
        });
    },
    onShow: function() {
        var t = {
            action: "order",
            contr: "my",
            token: wx.getStorageSync("token"),
            type: this.data.type
        };
        _tools2.default.request(t, function(t) {
            that.setData(t.info);
        });
    },
    copy: function(t) {
        var e = t.currentTarget.dataset.value;
        wx.setClipboardData({
            data: e,
            success: function(t) {
                wx.showToast({
                    title: "复制成功"
                });
            }
        });
    },
    tabbarOnTap: function(t) {
        var e = t.currentTarget.dataset.type;
        this.setData({
            type: e
        }), this.onShow();
    },
    giftDiscount: function(t) {
        var e = t.currentTarget.dataset.id, a = t.currentTarget.dataset.money;
        that.setData({
            discount_id: e
        });
        var o = wx.getStorageSync("token");
        wx.showModal({
            title: "提示",
            content: "确定要折现" + a + "元现金？",
            success: function(t) {
                t.confirm ? _tools2.default.request("discount", {
                    token: o,
                    id: e
                }, function(t) {
                    that.onShow();
                }) : t.cancel && console.log("用户点击取消");
            }
        });
    },
    gotoCollectGift: function(t) {
        var e = t.currentTarget.dataset.id;
        wx.navigateTo({
            url: "/bh_giftsays/pages/collectGift/collectGift?id=" + e
        });
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {
        return {
            title: this.data.share.text,
            imageUrl: this.data.share.images,
            path: "bh_bargain/pages/index/index?parent_id=" + this.data.share.member_id
        };
    }
});